/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.major;

import java.util.Collection;
import ru.jSkyRoom.interfaces.major.Dialog;
import ru.jSkyRoom.interfaces.major.DialogBranch;
import ru.jSkyRoom.interfaces.major.Info;
import ru.jSkyRoom.interfaces.major.Quest;
import skyproc.DIAL;
import skyproc.FormID;
import skyproc.INFO;

/**
 *
 * @author Rakev
 */
public class DialogBridge extends MajorBridge<DIAL> implements Dialog {

    public DialogBridge(DIAL adapting) {
        super(adapting);
    }

    @Override
    public String getDialog() {
        return getRawObject().getDialog();
    }

    @Override
    public void setDialog(String dialog) {
        getRawObject().setDialog(dialog);
    }

    @Override
    public float getPriority() {
        return getRawObject().getPriority();
    }

    @Override
    public void setPriority(float priority) {
        getRawObject().setPriority((float) priority);
    }

    @Override
    public DialogBranch getBranch() {
        FormID id = getRawObject().getBranch();
        return getFinderFactory().createDialogBranchFinder().find(id);
    }

    @Override
    public void setBranch(DialogBranch branch) {
        FormID id = getIdProducer().produce(branch);
        getRawObject().setBranch(id);
    }

    @Override
    public Quest getQuest() {
        FormID id = getRawObject().getQuest();
        return getFinderFactory().createQuestFinder().find(id);
    }

    @Override
    public void setQuest(Quest quest) {
        FormID id = getIdProducer().produce(quest);
        getRawObject().setQuest(id);
    }

    @Override
    public String getSubTypeName() {
        return getRawObject().getSubTypeName();
    }

    @Override
    public void setSubTypeName(String name) {
        getRawObject().setSubTypeName(name);
    }

    @Override
    public Collection<Info> getDialogTopicInfos() {
        Collection<INFO> records = getRawObject().getDialogTopicInfos();
        return (Collection) getBridgeFactory().createBridges(records);
    }
}
